package com.mephi.interfaces;

import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import com.mephi.controller.GameResult;
import com.mephi.model.Move;


/**
 * It contains operation on the game
 * @author mephisto
 * 2011-04-24
 * @param <E> Move or some of its subclass
 */
public interface Game<E extends Move> extends ListIterator<E>
{
	/**
	 * 
	 * @param id the id to set
	 */
	void setId(int id);
	
	/**
	 * 
	 * @return id of the game
	 */
	int getId();
	
	/**
	 * Removes all of the moves from this list
	 */
	 void clear(); 
	 
	 /**
	  * @return the instance of Move or some of its subclasses instance at the 
	  * specified position in the list
	  */
	 E get(int index);

	 /**
	  * @param index the index to set
	  * @param element the Move or some of its subclasses to set
	  * Replaces the element at the specified position in the list with the specified element 
	  */
	 E	set(int index, E element); 
	 
	 /**
	  * @return the number of Moves in the game
	  */
	 int size(); 
	 
	 /**
	  * @return true if the game contains the specified element 
	  */
	 boolean contains(Object o); 
	 
	 /**
	 * @return the event
	 */
	String getEvent();

	/**
	 * @param event the event to set
	 */
	void setEvent(String event);

	/**
	 * @return the site
	 */
	String getSite();

	/**
	 * @param site the site to set
	 */
	void setSite(String site);

	/**
	 * @return the round
	 */
	int getRound();

	/**
	 * @param round the round to set
	 */
	void setRound(int round);

	/**
	 * @return the white
	 */
	String getWhite();

	/**
	 * @param white the white to set
	 */
	void setWhite(String white);

	/**
	 * @return the black
	 */
	String getBlack();

	/**
	 * @param black the black to set
	 */
	void setBlack(String black);

	/**
	 * @return the result
	 */
	GameResult getResult();

	/**
	 * @param result the result to set
	 */
	void setResult(GameResult result);

	/**
	 * @return the timeControl
	 */
	String getTimeControl();

	/**
	 * @param timeControl the timeControl to set
	 */
	void setTimeControl(String timeControl);

	/**
	 * @return the whiteElo
	 */
	int getWhiteElo();

	/**
	 * @param whiteElo the whiteElo to set
	 */
	void setWhiteElo(int whiteElo);

	/**
	 * @return the blackElo
	 */
	int getBlackElo();

	/**
	 * @param blackElo the blackElo to set
	 */
	public void setBlackElo(int blackElo);

	/**
	 * @return the calendar
	 */
	Calendar getCalendar();

	/**
	 * @param calendar the calendar to set
	 */
	void setCalendar(Calendar calendar);
	
	/**
	 * @return the movesList
	 */
	List<E> getMovesList();

	/**
	 * @param movesList the movesList to set
	 * It makes old iterator invalid!
	 */
	void setMovesList(List<E> movesList);
	
	/**
	 * 
	 * @param position the position of chess pieces to set
	 * 
	 * @throws NullPointerException if position given as a parameter is null
	 */
	void setPosition(Position position);
	
	/**
	 * 
	 * @return the position of the chess pieces from which this game must be started 
	 */
	Position getPosition();
	
	/**
	 * @return an Iterator over Moves list
	 */
	Iterator<E> iterator();
	
	/**
	 * @return the GameIterator over list of movements
	 */
	GameIterator gameIterator();
}
